org.eclipse.vtp.framework.interactions.core.media
Interface IFormatter

All Known Implementing Classes:
SimpleEnglishVoiceFormatter, VoiceFormatter

public interface IFormatter

This interface outlines the functions responsible for transforming dynamic information into a language specific representation. Implementations of this interface will receive a piece of data, such as a date, through the corresponding function and produce a set of org.eclipse.vtp.framework.interactions.core.media.Content objects that contain the transformed information, e.g. a TextContent with the text "Monday, March 31st, 2008".

Author:
trip

Method Summary
 java.util.List formatDate(java.util.Date date, java.lang.String formatDefinition, IResourceManager resourceManager)
          Transforms the supplied date information into a language specific sequence of elements following the given definition using the provided resource manager to locate file resources.

If the definition is not recognized or invalid, the default definition should be used.
 java.util.List formatDigits(java.lang.String digits, java.lang.String formatDefinition, IResourceManager resourceManager)
          Transforms the supplied string of digits into a language specific sequence of elements following the given definition using the provided resource manager to locate file resources.

If the definition is not recognized or invalid, the default definition should be used.
 java.util.List formatLetters(java.lang.String text, java.lang.String formatDefinition, IResourceManager resourceManager)
          Transforms the supplied string of letters into a language specific sequence of elements following the given definition using the provided resource manager to locate file resources.

If the definition is not recognized or invalid, the default definition should be used.
 java.util.List formatMoney(java.math.BigDecimal money, java.util.Currency currency, java.lang.String formatDefinition, IResourceManager resourceManager)
          Transforms the supplied monetary amount into a language specific sequence of elements following the given definition using the provided resource manager to locate file resources.

If the definition is not recognized or invalid, the default definition should be used.
 java.util.List formatNumber(int number, java.lang.String formatDefinition, IResourceManager resourceManager)
          Transforms the supplied number into a language specific sequence of elements following the given definition using the provided resource manager to locate file resources.

If the definition is not recognized or invalid, the default definition should be used.
 java.util.List formatOrdinal(int ordinal, java.lang.String formatDefinition, IResourceManager resourceManager)
          Transforms the supplied ordinal value into a language specific sequence of elements following the given definition using the provided resource manager to locate file resources.

If the definition is not recognized or invalid, the default definition should be used.
 java.lang.String getDefaultFormatDefintion(FormattableContent formattable, java.lang.String formatName)
          Returns the string representation of the specialization of the given name and for the given formattable content type.
 java.util.List getDefaultFormats(FormattableContent formattable)
          Returns the List of Strings containing the readable names of any built-in specializations available for given formattable content.
 java.lang.String getLanguageCode()
           
 java.lang.String getLanguageName()
           
 

Method Detail

getLanguageCode

java.lang.String getLanguageCode()
Returns:
The language code supported by this formatter, e.g. en-US.

getLanguageName

java.lang.String getLanguageName()
Returns:
The readable name of the language supported by this formatter, e.g. English.

formatDate

java.util.List formatDate(java.util.Date date,
                          java.lang.String formatDefinition,
                          IResourceManager resourceManager)
Transforms the supplied date information into a language specific sequence of elements following the given definition using the provided resource manager to locate file resources.

If the definition is not recognized or invalid, the default definition should be used. This event may be logged but should never produce an exception.

Parameters:
date - The date to translate to text.
formatDefinition - The provided specialized format to use during transformation.
resourceManager - Provides access to the available file resources.
Returns:
A list of org.eclipse.vtp.framework.interactions.core.media.Content objects that contain the formatted elements of the provided date.

formatDigits

java.util.List formatDigits(java.lang.String digits,
                            java.lang.String formatDefinition,
                            IResourceManager resourceManager)
Transforms the supplied string of digits into a language specific sequence of elements following the given definition using the provided resource manager to locate file resources.

If the definition is not recognized or invalid, the default definition should be used. This event may be logged but should never produce an exception.

Parameters:
digits - The digits to translate to text.
formatDefinition - The provided specialized format to use during transformation.
resourceManager - Provides access to the available file resources.
Returns:
A list of org.eclipse.vtp.framework.interactions.core.media.Content objects that contain the formatted elements of the provided sequence of digits.

formatMoney

java.util.List formatMoney(java.math.BigDecimal money,
                           java.util.Currency currency,
                           java.lang.String formatDefinition,
                           IResourceManager resourceManager)
Transforms the supplied monetary amount into a language specific sequence of elements following the given definition using the provided resource manager to locate file resources.

If the definition is not recognized or invalid, the default definition should be used. This event may be logged but should never produce an exception.

Parameters:
money - The amount to translate to text.
currency - The currency the amount is in.
formatDefinition - The provided specialized format to use during transformation.
resourceManager - Provides access to the available file resources.
Returns:
A list of org.eclipse.vtp.framework.interactions.core.media.Content objects that contain the formatted elements of the provided monetary value.

formatNumber

java.util.List formatNumber(int number,
                            java.lang.String formatDefinition,
                            IResourceManager resourceManager)
Transforms the supplied number into a language specific sequence of elements following the given definition using the provided resource manager to locate file resources.

If the definition is not recognized or invalid, the default definition should be used. This event may be logged but should never produce an exception.

Parameters:
number - The number to translate to text.
formatDefinition - The provided specialized format to use during transformation.
resourceManager - Provides access to the available file resources.
Returns:
A list of org.eclipse.vtp.framework.interactions.core.media.Content objects that contain the formatted elements of the provided number.

formatOrdinal

java.util.List formatOrdinal(int ordinal,
                             java.lang.String formatDefinition,
                             IResourceManager resourceManager)
Transforms the supplied ordinal value into a language specific sequence of elements following the given definition using the provided resource manager to locate file resources.

If the definition is not recognized or invalid, the default definition should be used. This event may be logged but should never produce an exception.

Parameters:
ordinal - The ordinal to translate to text.
formatDefinition - The provided specialized format to use during transformation.
resourceManager - Provides access to the available file resources.
Returns:
A list of org.eclipse.vtp.framework.interactions.core.media.Content objects that contain the formatted elements of the provided ordinal value.

formatLetters

java.util.List formatLetters(java.lang.String text,
                             java.lang.String formatDefinition,
                             IResourceManager resourceManager)
Transforms the supplied string of letters into a language specific sequence of elements following the given definition using the provided resource manager to locate file resources.

If the definition is not recognized or invalid, the default definition should be used. This event may be logged but should never produce an exception.

Parameters:
letter - The letter to translate.
formatDefinition - The provided specialized format to use during transformation.
resourceManager - Provides access to the available file resources.
Returns:
A list of org.eclipse.vtp.framework.interactions.core.media.Content objects that contain the formatted elements of the provided string of letters.

getDefaultFormats

java.util.List getDefaultFormats(FormattableContent formattable)
Returns the List of Strings containing the readable names of any built-in specializations available for given formattable content. Not all formattable content will have built-in specializations.

A phone number would be a good example of a specialization that could be created for the DigitsContent type of content. There are some common rules around how a phone number is read back in contrast to just a string of numbers.

Parameters:
formattable - The type of content to find specializations for.
Returns:
A list of strings or an empty list if no specializations are available.

getDefaultFormatDefintion

java.lang.String getDefaultFormatDefintion(FormattableContent formattable,
                                           java.lang.String formatName)
Returns the string representation of the specialization of the given name and for the given formattable content type. This name/definition mechanism exists to provide facilities for formatters that wish to allow user defined formats.

For example, a formatter may allow the user to specify how they want the content to be formatted using a mark up language similar to the printf family of functions in C and Java.

Parameters:
formattable - The type of content to retrieve the definition for.
formatName - The name of the definition.
Returns:
The format definition.